perm filename XLATE.DON[UP,DOC] blob
sn#381109 filedate 1978-09-20 generic text, type T, neo UTF8
XLATE is a quick hack for doing simple character substitutions throughout
a file. Each of the 200 (octal) possible characters in the input file is
converted to an arbitrary user-specified string in the output file; the
default string is the character itself, i.e., no change. The advantages
of XLATE over, say, E, are that (a) XLATE is considerably faster and (b)
XLATE lets you process all 200 character codes, whereas E loses certain
characters (nulls, alt-modes, and rubouts).
To use XLATE, first R XLATE. It will print OUTPUT←INPUT/SWITCHES, which
is the command format. If you omit one of the file names, the output file
will overwrite the input. Each switch must start with a slash, and is of
the form /<char>←<string>, where "=" may replace the "←". ("=" may also
replace the "←" between the two file names.)
The <char> is either a single character, in which case it is the character
being replaced by <string>, or else an apostrophe followed by an octal
value. (If an apostrophe is followed immediately by the ← or =, then the
apostrophe is taken to be the character to use.)
The <string> consists of one or more substrings concatenated with "&".
Each substring is either a single character other than a double-quote ("),
or an apostrophe followed by an octal value, or a string of characters
enclosed in double-quotes. (A double-quote may be included in the string
by putting two consecutive double-quotes.)
Thus, for example, the command:
*FOO←BAR/'40='15&'12/'15=""/'12='40/X=Y/Y=X/←=":="/'=""""
would have the rather unlikely effect of copying BAR into FOO while
changing all spaces into crlfs, all crlfs into spaces (actually, cr's get
discarded and lf's become spaces), capital X's into Y's and vice versa,
left-arrows into colon-equals's, and apostrophes into double-quotes.